var gameOver: Texture;
var exit	: Texture;

// Cannot call OnGUI from another method i.e. OnTriggerEnter
// Set a boolean to control the OnGUI behaviour instead
var enableGUI = false;

function OnGUI()
{
	if(enableGUI)
	{
		// Display GUI
		GUI.Box(Rect((Screen.width/2)-250, (Screen.height/2)-130, gameOver.width, gameOver.height), gameOver);
		
		// If player clicks button, load Menu Scene (basically restart the game)
		if(GUI.Button(Rect((Screen.width/2)-250, (Screen.height/2), exit.width, exit.height), exit))
			Application.LoadLevel("Menu");
	}
}

function OnTriggerEnter(pCollision : Collider)
{
	if(pCollision.tag == "Player")
	{
		//Debug.Log("Exit Collision!");
		
		// trigger the OnGUI code
		enableGUI = true;
		
	}
}